//业务逻辑层
import 'package:hive_storage/data/local_storage/storage_service.dart';

import '../models/settings_model.dart';

class SettingsRepository{
  late final StorageService storage;
  SettingsRepository(this.storage);
  static const _settingsKey = 'app_settings';
  Future<SettingsModel> getSettings() async{
    final settings = storage.get<SettingsModel>(_settingsKey);
    return settings ?? SettingsModel(
      isDarkMode:false,
      notificationsEnabled: true,
      languageCode: 'En',
    );
  }
  Future<void> saveSettings(SettingsModel settings) async{
    await storage.save(_settingsKey, settings);
  }
}